'use strict';
let Response = require('../../../model/Response');
let RestifyProxy = require('../../../util/RestifyProxy');
let CustomPageBean = require('../../../model/CustomPageBean');
let simService = require('../../../service/operate/simService');
let logger = require('../../../util/LoggerUtil').logger('simController.js');

/**
 * sim卡管理——页面
 */
module.exports.simPage = function () {
  let response = new Response();
  response.render('back/operate/sim/sim');//html路径
  this.resolve(response);
};

/**
 * sim卡管理——列表数据
 */
module.exports.simList = async function () {
  let req = this.req;
  let params = req.body;
  let response = new Response();
  try {
    let result = await simService.simList(this, params);
    let pageBean = new CustomPageBean(result);
    response.send(pageBean);
  } catch (error) {
    logger.error(error);
  }
  this.resolve(response);
};
/**
 * sim卡管理-详情页面
 */
module.exports.simDetailPage = function () {
  let response = new Response();
  response.render('back/operate/sim/sim-detail');
  this.resolve(response);
};
/*sim卡管理-详情页面-获取详情*/
module.exports.simDetail = async function () {
  let req = this.req;
  let params = req.body;
  let response = new Response();
  try {
    let result = await simService.simDetail(this, params);
    response.send(result);
  } catch (error) {
    logger.error(error);
  }
  this.resolve(response);
};
/*sim卡管理-详情页面-更新详情按钮*/
module.exports.simUpdateDetail = async function () {
  let req = this.req;
  let params = req.body;
  let response = new Response();
  try {
    let result = await simService.simUpdateDetail(this, params);
    response.send(result);
  } catch (error) {
    logger.error(error);
  }
  this.resolve(response);
};